/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 actor.h

	$Header: /heroes4/actor.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ACTOR_H_INCLUDED )
#define ACTOR_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_adv_actor.h"
#include "actor_sequence_ptr.h"
#include "adventure_object.h"

#pragma warning( push )
#pragma warning( disable: 4250 ) // Disable the "inherits via domininance" warning

enum t_adv_actor_action_id;
enum t_direction;

class t_actor : public t_abstract_adv_actor, public t_adventure_object
{
public:
	// Constructor
	t_actor();

	// Member functions
	virtual void          draw_shadow_to( t_uint32              current_time, 
		                                  t_screen_rect const&  source_rect,
		                                  t_abstract_bitmap16&  dest, 
								          t_screen_point const& dest_point ) const;
	virtual void          draw_shadow_to(   t_uint32              current_time,
		                                    t_abstract_bitmap16&  dest, 
		                                    t_screen_point const& dest_point ) const;
	t_adv_actor_action_id  get_action() const;
	t_direction            get_direction() const;
	int					   get_frame() const;
	int					   get_frame( t_uint32 current_time ) const;
	int				       get_frame_count() const;
	int					   get_frame_delay() const;
	virtual t_screen_point get_frame_offset() const;
	virtual std::string    get_name() const = 0;
	virtual t_screen_rect  get_shadow_rect() const;
	virtual t_screen_rect  get_shadow_rect( t_uint32 current_time ) const;
	bool				   has_action( t_adv_actor_action_id action ) const;
	virtual bool		   is_actor() const;
	virtual bool           read( std::streambuf& stream, int version );
	void                   set_action( t_adv_actor_action_id sequence );
	void                   set_direction( t_direction direction );
	void				   set_frame( int frame );
	void                   set_frame_offset( t_screen_point const& offset );
	void				   turn_to( t_direction direction );
	virtual bool		   write_object( std::streambuf& buffer ) const;
protected:
	virtual void	on_model_changed();

	t_adv_actor_action_id	m_action;
	t_actor_sequence_ptr	m_current_sequence;
	int						m_frame;
	int						m_frame_delay;
	int						m_frame_count;
	t_screen_point			m_frame_offset;
	t_direction				m_direction;
	int						m_start_time;

private:
	virtual bool			do_animates() const;
	virtual void			do_draw_to(
								t_uint32				current_time,
								t_screen_rect const &	source_rect,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point,
								int						alpha = 15 ) const;
	virtual void			do_draw_to(
								t_uint32				current_time,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	virtual t_screen_rect	do_get_rect() const;
	virtual t_screen_rect	do_get_rect( t_uint32 current_time ) const;
	virtual bool			do_hit_test(
								t_uint32				current_time,
								t_screen_point const &	point ) const;
	virtual bool			do_needs_redrawing(
								t_uint32	last_update_time, 
								t_uint32	current_time ) const;
	virtual bool			do_visible_through_obstacles() const;
};

inline t_adv_actor_action_id t_actor::get_action() const
{
	return m_action;
}

inline t_direction t_actor::get_direction() const
{
	return m_direction;
}

inline int t_actor::get_frame() const
{
	return m_frame;
}

inline int t_actor::get_frame_count() const
{
	return m_frame_count;
}

inline int t_actor::get_frame_delay() const
{
	return m_frame_delay;
}

#pragma warning(pop)

#endif // ACTOR_H_INCLUDED